package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.maintenancesystem.task;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.maintenancesystem.task.TaskService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * @Author: YangYu
 * @ClassName: TaskController
 * @Date: Created in 15:24 2021/1/26
 * @Description: 任务
 */
@Action
@RequestMapping(value = "task")
public class TaskController extends BaseController {

    @Resource
    private TaskService taskService;

    /**
     * @Author YangYu
     * @Description 任务-每天任务分页列表
     * @Date Created in 11:45 2021/1/5
     * @Param [jsonParam]
     */

    @At(value = "taskEverydayPagList", method = RequestMethod.GET, param = {"page", "limit"})
    public RespEntity taskEverydayPagList(@RequestBody(required = false) JSONObject jsonParam) {
        return taskService.taskEverydayPagList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 每天任务详情
     * @Date Created in 15:11 2021/1/5
     * @Param [jsonParam]
     */

    @At(value = "taskEverydayDetail", method = RequestMethod.GET)
    public RespEntity taskEverydayDetail(@RequestBody(required = false) JSONObject jsonParam) {
        return taskService.taskEverydayDetail(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 任务指派
     * @Date Created in 13:39 2021/1/7
     * @Param [jsonParam]
     */

    @At(value = "assignTasks", method = RequestMethod.POST)
    public RespEntity assignTasks(@RequestBody(required = false) JSONObject jsonParam) {
        return taskService.assignTasks(jsonParam);
    }
    /**
     * @Author YangYu
     * @Description 任务检测状态提交
     * @Date Created in 15:11 2021/1/5
     * @Param [jsonParam]
     */

    @At(value = "maintenanceOrMaintainSubmit", method = RequestMethod.POST)
    public RespEntity maintenanceOrMaintainSubmit(@RequestBody(required = false) JSONObject jsonParam) {
        return taskService.maintenanceOrMaintainSubmit(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 任务完成提交
     * @Date Created in 13:39 2021/1/7
     * @Param [jsonParam]
     */

    @At(value = "submit", method = RequestMethod.POST)
    public RespEntity submit(@RequestBody(required = false) JSONObject jsonParam) {
        return taskService.submit(jsonParam);
    }
    /**
     * @Author YangYu
     * @Description 总的开始检测
     * @Date Created in 13:39 2021/1/7
     * @Param [jsonParam]
     */

    @At(value = "startTesting", method = RequestMethod.POST, param = {"id"})
    public RespEntity startTesting(@RequestBody(required = false) JSONObject jsonParam) {
        return taskService.startTesting(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 下载报告记录新增
     * @Date Created in 13:39 2021/1/7
     * @Param [jsonParam]
     */

    @At(value = "reportAdd", method = RequestMethod.POST)
    public RespEntity reportAdd(@RequestBody(required = false) JSONObject jsonParam) {
        return taskService.reportAdd(jsonParam);
    }
    /**
     * @Author YangYu
     * @Description 下载报告记录列表
     * @Date Created in 13:39 2021/1/7
     * @Param [jsonParam]
     */

    @At(value = "reportPageList", method = RequestMethod.GET)
    public RespEntity reportPageList(@RequestBody(required = false) JSONObject jsonParam) {
        return taskService.reportPageList(jsonParam);
    }
    @At(value = "reportPageDelete", method = RequestMethod.POST)
    public RespEntity reportPageDelete(@RequestBody(required = false) JSONObject jsonParam) {
        return taskService.reportPageDelete(jsonParam);
    }
    @At(value = "taskComponentState", method = RequestMethod.POST)
    public RespEntity taskComponentState(@RequestBody(required = false) JSONObject jsonParam) {
        return taskService.taskComponentState(jsonParam);
    }
}
